<!DOCTYPE HTML>
<html>

<head>
	<link rel="bookmark"  type="image/x-icon"  href="/img/logo_miccall.png"/>
	<link rel="shortcut icon" href="/img/logo_miccall.png">
	
			    <title>
    Ame雨
    </title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="/amelin-ting/css/mic_main.css" />
    <link rel="stylesheet" href="/amelin-ting/css/dropdownMenu.css" />
    <meta name="keywords" content="Ame雨" />
    
    	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	 
    <noscript>
        <link rel="stylesheet" href="/amelin-ting/css/noscript.css" />
    </noscript>
    <style type="text/css">
        body:before {
          content: ' ';
          position: fixed;
          top: 0;
          background: url('/amelin-ting/img/bg.jpg') center 0 no-repeat;
          right: 0;
          bottom: 0;
          left: 0;
          background-size: cover; 
        }
    </style>

			    
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script async type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


    <script src="/amelin-ting/js/jquery.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrollex.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrolly.min.js"></script>
    <script src="/amelin-ting/js/skel.min.js"></script>
    <script src="/amelin-ting/js/util.js"></script>
    <script src="/amelin-ting/js/main.js"></script>
	
<meta name="generator" content="Hexo 5.4.0"></head>
    
		
<!-- Layouts -->



<!--  代码渲染  -->
<link rel="stylesheet" href="/css/prism_coy.css" />
<link rel="stylesheet" href="/css/typo.css" />
<!-- 文章页 -->
<body class="is-loading">
    <!-- Wrapper 外包 s-->
    <div id="wrapper" class="fade-in">
        <!-- Intro 头部显示 s -->
        <!-- Intro 头部显示 e -->
        <!-- Header 头部logo start -->
        <header id="header">
    <a href="/amelin-ting/" class="logo">Art Space</a>
</header>
        <!-- Nav 导航条 start -->
        <nav id="nav" class="special" >
            <ul class="menu links" >
			<!-- Homepage  主页  --> 
			<li >
	            <a href="/amelin-ting/" rel="nofollow">主页</a>
	        </li>
			<!-- categories_name  分类   --> 
	        
	        <li class="active">
	            <a href="#s1">分类</a>
	                    <ul class="submenu">
	                        <li>
	                        <a class="category-link" href="/amelin-ting/categories/Go/">Go</a></li><li><a class="category-link" href="/amelin-ting/categories/django/">django</a></li><li><a class="category-link" href="/amelin-ting/categories/drf/">drf</a></li><li><a class="category-link" href="/amelin-ting/categories/gin/">gin</a></li><li><a class="category-link" href="/amelin-ting/categories/go/">go</a></li><li><a class="category-link" href="/amelin-ting/categories/linux/">linux</a></li><li><a class="category-link" href="/amelin-ting/categories/mysql/">mysql</a></li><li><a class="category-link" href="/amelin-ting/categories/python/">python</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/">内网穿透</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%89%8D%E7%AB%AF/">前端</a>
	                    </ul>
	        </li>
	        
	        <!-- archives  归档   --> 
	        
	        
		        <!-- Pages 自定义   -->
		        
		        <li>
		            <a href="/about/" title="简历">
		                简历
		            </a>
		        </li>
		        
		        <li>
		            <a href="/group/" title="团队">
		                团队
		            </a>
		        </li>
		        
		        <li>
		            <a href="/gallery/" title="图库">
		                图库
		            </a>
		        </li>
		        
		        <li>
		            <a href="/tag/" title="标签">
		                标签
		            </a>
		        </li>
		        


            </ul>
            <!-- icons 图标   -->
			<ul class="icons">
                    
                    <li>
                        <a title="github" href="https://github.com/miccall" target="_blank" rel="noopener">
                            <i class="icon fa fa-github"></i>
                        </a>
                    </li>
                    
                    <li>
                        <a title="500px" href="http://500px.com" target="_blank" rel="noopener">
                            <i class="icon fa fa-500px"></i>
                        </a>
                    </li>
                    
			</ul>
</nav>

        <div id="main" >
            <div class ="post_page_title_img" style="height: 25rem;background-image: url(https://img1.baidu.com/it/u=3754057496,2919897964&amp;fm=26&amp;fmt=auto);background-position: center; background-repeat:no-repeat; background-size:cover;-moz-background-size:cover;overflow:hidden;" >
                <a href="#" style="padding: 4rem 4rem 2rem 4rem ;"><h2 >Go 基础知识</h2></a>
            </div>
            <!-- Post -->
            <div class="typo" style="padding: 3rem;">
                <h2 id="一、Go的简单-语法"><a href="#一、Go的简单-语法" class="headerlink" title="一、Go的简单 语法"></a>一、Go的简单 语法</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span>代码演示</span><br><span class="line">    <span class="keyword">package</span> main <span class="comment">// go 每个文件必须指定包,如果是执行文件,则必须指定main  </span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">import</span> <span class="string">&quot;fmt&quot;</span> <span class="comment">// 引入fmt fmt功能是把字符串输出 </span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 程序执行的入口函数</span></span><br><span class="line">    <span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</span><br><span class="line">        fmt.Print(<span class="string">&quot;hello world&quot;</span>) <span class="comment">// 直接打印 类似于Python的print</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;hello world， %d&quot;</span>, <span class="number">100</span>) <span class="comment">// 格式化输出</span></span><br><span class="line">        fmt.Println(<span class="string">&quot;hello world&quot;</span>) <span class="comment">// 输出完成自动换行</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">var</span> a <span class="keyword">int</span> <span class="comment">// 定义一个变量接收用户输入的值</span></span><br><span class="line">        fmt.Scan(&amp;a) <span class="comment">// 类似于Python的input</span></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> Go程序结构</span><br><span class="line">	<span class="keyword">go</span>源码按<span class="keyword">package</span>进行组织,并且<span class="keyword">package</span>要放到非注释的第一行</span><br><span class="line">	一个<span class="keyword">go</span>文件必须有<span class="keyword">package</span> &amp; <span class="keyword">import</span> &amp; <span class="function"><span class="keyword">func</span> <span class="title">main</span> ...</span></span><br><span class="line">	函数外只能放置标识符(变量)常量、函数、类型的声明</span><br><span class="line">	一个程序只有一个main函数 <span class="comment">// 就是说 一个文件夹下只有一个main  而且main包和main函数是一一对应</span></span><br><span class="line">	main函数是程序的执行入口</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="二、Go的简单命令"><a href="#二、Go的简单命令" class="headerlink" title="二、Go的简单命令"></a>二、Go的简单命令</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> <span class="keyword">go</span> run </span><br><span class="line">	<span class="comment">// 快速执行go文件,就像执行脚本一样</span></span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> <span class="keyword">go</span> build</span><br><span class="line">	<span class="comment">// 编译程序,生成二进制可执行文件	</span></span><br><span class="line"></span><br><span class="line"><span class="number">3.</span> <span class="keyword">go</span> install</span><br><span class="line">	<span class="comment">// 安装可执行文件到bin目录</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">	一个目录下的包一定要是一样的</span></span><br><span class="line"><span class="comment">	如果调用了另一个文件的函数，用go run，必须得带上另一个文件的名字</span></span><br><span class="line"><span class="comment">	如 go run hello.go world.go</span></span><br><span class="line"><span class="comment">	go build 则就直接编译出来文件了</span></span><br><span class="line"><span class="comment">	还有如果不在源目录去执行go build等，使用绝对路径时，不用带src，因为程序是必须在src下写的，默认自带</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="number">4.</span> <span class="keyword">go</span> test </span><br><span class="line">	<span class="comment">// 执行单元测试或压力测试</span></span><br><span class="line"></span><br><span class="line"><span class="number">5.</span> <span class="keyword">go</span> env </span><br><span class="line">	<span class="comment">// 显示go相关的环境变量</span></span><br><span class="line"></span><br><span class="line"><span class="number">6.</span> <span class="keyword">go</span> fmt</span><br><span class="line">	<span class="comment">// 格式化源代码 相当于Python的快捷键 ctrl + L</span></span><br></pre></td></tr></table></figure>

<h2 id="三、Go的注释"><a href="#三、Go的注释" class="headerlink" title="三、Go的注释"></a>三、Go的注释</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 单行注释</span><br><span class="line">		<span class="comment">//</span></span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 多行注释</span><br><span class="line">		<span class="comment">/**/</span></span><br></pre></td></tr></table></figure>

<h2 id="四、Go标识符-amp-关键字"><a href="#四、Go标识符-amp-关键字" class="headerlink" title="四、Go标识符&amp;关键字"></a>四、Go标识符&amp;关键字</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 标识符</span><br><span class="line">	在编程语言中标识符就是程序员定义的具有特殊意义的词，比如变量名、常量名、函数名等等。 </span><br><span class="line">	Go语言中标识符由字母数字和_(下划线）组成，并且只能以字母和_开头。 举几个例子：abc, _, _123, a123。</span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 关键字</span><br><span class="line">	关键字是Go语言事先规定好的，有特殊含义的标识符。</span><br><span class="line">	关键字和保留字都不建议用作变量名。</span><br></pre></td></tr></table></figure>

<h2 id="五、Go的变量"><a href="#五、Go的变量" class="headerlink" title="五、Go的变量"></a>五、Go的变量</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 变量 </span><br><span class="line">	<span class="keyword">var</span> 变量名 变量类型</span><br><span class="line">	<span class="comment">// Go语言的变量必须先声明在使用</span></span><br><span class="line">	<span class="comment">// Go语言中非全局变量声明必须使用 推荐使用驼峰体命名</span></span><br><span class="line"><span class="number">2.</span> 全局变量常用方法</span><br><span class="line">	<span class="keyword">var</span> a <span class="keyword">int</span></span><br><span class="line">	<span class="keyword">var</span> b <span class="keyword">string</span></span><br><span class="line">	<span class="keyword">var</span> c <span class="keyword">bool</span></span><br><span class="line">	<span class="keyword">var</span> d <span class="keyword">int</span> = <span class="number">8</span> </span><br><span class="line">	<span class="keyword">var</span> e <span class="keyword">string</span> = <span class="string">&#x27;name&#x27;</span></span><br><span class="line">	<span class="comment">// 还可以写成</span></span><br><span class="line">	<span class="keyword">var</span> (</span><br><span class="line">        a <span class="keyword">int</span> <span class="comment">// 0</span></span><br><span class="line">        b <span class="keyword">string</span> <span class="comment">// &#x27;&#x27;</span></span><br><span class="line">        c <span class="keyword">bool</span> <span class="comment">// false</span></span><br><span class="line">        d <span class="keyword">int</span> = <span class="number">2</span> <span class="comment">// 2</span></span><br><span class="line">        e <span class="keyword">string</span> = <span class="string">&quot;name&quot;</span> <span class="comment">// name</span></span><br><span class="line">	)</span><br><span class="line"><span class="number">3.</span> 局部变量常用方法</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">var</span> s2 = <span class="string">&quot;20&quot;</span> <span class="comment">// 类型推导，可以省略变量类型，这个时候编译器会根据等号右边的值来推导变量的类型完成初始化</span></span><br><span class="line">	s3 := <span class="string">&quot;哈哈&quot;</span> <span class="comment">// 简短变量声明 只能在函数体内使用</span></span><br><span class="line"><span class="number">4.</span> 变量的初始化</span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">        Go语言在声明变量的时候，会自动对变量对应的内存区域进行初始化操作。每个变量会被初始化成其类型的的默认值。</span></span><br><span class="line"><span class="comment">        整型与浮点型 默认值为0</span></span><br><span class="line"><span class="comment">        字符串变量的默认值为&quot;&quot;(空字符串)</span></span><br><span class="line"><span class="comment">        布尔型变量的默认值为false</span></span><br><span class="line"><span class="comment">        切片、函数、指针变量的默认值为nil</span></span><br><span class="line"><span class="comment">        我们也可以再声明变量的时候指定初始值</span></span><br><span class="line"><span class="comment">        var 变量名 变量类型 = 表达式</span></span><br><span class="line"><span class="comment">      		var name string = &quot;Ame&quot;</span></span><br><span class="line"><span class="comment">        也可以一次性初始化多个变量</span></span><br><span class="line"><span class="comment">        	var name, age = &quot;Ame&quot;, 18</span></span><br><span class="line"><span class="comment">    */</span></span><br><span class="line"><span class="number">5.</span> 匿名变量</span><br><span class="line">	在使用多重赋值时，如果想要忽略某个值，可以使用匿名变量。匿名变量用一个下划线_表示。</span><br><span class="line">    <span class="function"><span class="keyword">func</span> <span class="title">addStudent</span><span class="params">(allStudent <span class="keyword">map</span>[<span class="keyword">string</span>]Student)</span></span> &#123;</span><br><span class="line">        stu := getAllStudent()</span><br><span class="line">        _, ok := allStudent[stu.Name]</span><br><span class="line">        <span class="keyword">if</span> ok &#123;</span><br><span class="line">            fmt.Printf(<span class="string">&quot;student %s is exists\n&quot;</span>, stu.Name)</span><br><span class="line">        &#125;</span><br><span class="line">        allStudent[stu.Name] = stu</span><br><span class="line">    &#125;</span><br><span class="line">	<span class="comment">// 匿名变量 不占用命名空间，不会分配内存，所以匿名变量之间不存在重复声明。</span></span><br><span class="line"><span class="number">6.</span> 注意事项</span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">    函数外的每个语句都必须以关键字开始(var, const, func等)</span></span><br><span class="line"><span class="comment">    := 不能是用在函数外</span></span><br><span class="line"><span class="comment">    _多用于占位，表示忽略值</span></span><br><span class="line"><span class="comment">    同一个作用域(&#123;&#125;)不能重复声明同名的变量</span></span><br><span class="line"><span class="comment">    匿名变量是一个特殊的变量</span></span><br><span class="line"><span class="comment">    */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="六、Go的常量"><a href="#六、Go的常量" class="headerlink" title="六、Go的常量"></a>六、Go的常量</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 常量</span><br><span class="line">	<span class="keyword">const</span> name [<span class="keyword">type</span>] = value, 代表永远是只读的, 不能修改, 其中<span class="keyword">type</span>可以省略</span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 举例</span><br><span class="line">	<span class="keyword">const</span> s <span class="keyword">string</span> = <span class="string">&#x27;hello world&#x27;</span></span><br><span class="line">	<span class="keyword">const</span> s = <span class="string">&#x27;hello world&#x27;</span></span><br><span class="line">	<span class="keyword">const</span> Pi = <span class="number">3.1414926</span></span><br><span class="line">	<span class="keyword">const</span> a = <span class="number">9</span>/<span class="number">3</span></span><br><span class="line"></span><br><span class="line"><span class="number">3.</span> 比较优雅的写法</span><br><span class="line">    <span class="keyword">const</span> (</span><br><span class="line">        a = <span class="number">1</span></span><br><span class="line">        b = <span class="number">2</span></span><br><span class="line">        c = <span class="number">3</span></span><br><span class="line">    ) <span class="comment">// 批量声明常量</span></span><br><span class="line"></span><br><span class="line"><span class="number">4.</span> 更优雅(装B)的写法 </span><br><span class="line">    <span class="keyword">const</span> (</span><br><span class="line">        a = <span class="number">100</span> <span class="comment">// 100</span></span><br><span class="line">        b <span class="comment">// 100</span></span><br><span class="line">        c <span class="comment">// 100</span></span><br><span class="line">    )</span><br><span class="line">	<span class="comment">// iota: 会1-2-3-4加下去,下面的不写,就是默认选择最近的相同</span></span><br><span class="line">        <span class="keyword">const</span> (</span><br><span class="line">            a = <span class="literal">iota</span>  <span class="comment">// 0</span></span><br><span class="line">            b <span class="comment">// 1</span></span><br><span class="line">            c <span class="comment">// 2</span></span><br><span class="line">        )</span><br><span class="line"></span><br><span class="line">        <span class="keyword">const</span> (</span><br><span class="line">            a = <span class="literal">iota</span> <span class="comment">// 0</span></span><br><span class="line">            b <span class="comment">// 1</span></span><br><span class="line">            _ <span class="comment">// 2</span></span><br><span class="line">            c <span class="comment">// 3</span></span><br><span class="line">        )</span><br><span class="line">        <span class="comment">// 插队</span></span><br><span class="line">        <span class="keyword">const</span> (</span><br><span class="line">            a = <span class="literal">iota</span> <span class="comment">// 0</span></span><br><span class="line">            b = <span class="number">100</span> <span class="comment">// 100</span></span><br><span class="line">            c = <span class="literal">iota</span> <span class="comment">// 2</span></span><br><span class="line">            d <span class="comment">// 3</span></span><br><span class="line">        )</span><br><span class="line">        <span class="comment">// 多个变量在一行</span></span><br><span class="line">        <span class="keyword">const</span> (</span><br><span class="line">            d1, d2 = <span class="literal">iota</span> + <span class="number">1</span>, <span class="literal">iota</span> + <span class="number">2</span> <span class="comment">// d1: 1  d2: 2</span></span><br><span class="line">            d3, d4 = <span class="literal">iota</span> + <span class="number">1</span>, <span class="literal">iota</span> + <span class="number">2</span> <span class="comment">// d3: 2  d4: 3</span></span><br><span class="line">        )</span><br><span class="line"></span><br><span class="line"><span class="number">5.</span> 定义数量级</span><br><span class="line">    <span class="keyword">const</span> (</span><br><span class="line">            _  = <span class="literal">iota</span></span><br><span class="line">            KB = <span class="number">1</span> &lt;&lt; (<span class="number">10</span> * <span class="literal">iota</span>)</span><br><span class="line">            MB = <span class="number">1</span> &lt;&lt; (<span class="number">10</span> * <span class="literal">iota</span>)</span><br><span class="line">            GB = <span class="number">1</span> &lt;&lt; (<span class="number">10</span> * <span class="literal">iota</span>)</span><br><span class="line">            TB = <span class="number">1</span> &lt;&lt; (<span class="number">10</span> * <span class="literal">iota</span>)</span><br><span class="line">            PB = <span class="number">1</span> &lt;&lt; (<span class="number">10</span> * <span class="literal">iota</span>)</span><br><span class="line">        )</span><br><span class="line"><span class="comment">// 1 &lt;&lt;是便是将1左移10位，然后二进制转换成10进制，在这里就是1024</span></span><br></pre></td></tr></table></figure>




            </div>

            <!-- Post Comments -->
            
    <!-- 使用 DISQUS_CLICK -->
<div id="disqus-comment">
    <div id="disqus_thread"></div>

<!-- add animation -->
<style>
	.disqus_click_btn {
            line-height: 30px;
            margin: 0;
            min-width: 50px;
            padding: 0 14px;
            display: inline-block;
            font-family: "Roboto", "Helvetica", "Arial", sans-serif;
            font-size: 14px;
            font-weight: 400;
            text-transform: uppercase;
            letter-spacing: 0;
            overflow: hidden;
            will-change: box-shadow;
            transition: box-shadow .2s cubic-bezier(.4, 0, 1, 1), background-color .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
            outline: 0;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            vertical-align: middle;
            border: 0;
            background: rgba(158, 158, 158, .2);
            box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
            color: #fff;
            background-color: #7EC0EE;
            text-shadow: 0
        }
</style>
	
<div class="btn_click_load" id="disqus_bt"> 
    <button class="disqus_click_btn">点击查看评论</button>
</div>

<!--
<script type="text/javascript">
$('.btn_click_load').click(function() {
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'http-miccall-tech'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();

    document.getElementById('disqus_bt').style.display = "none";
});
</script>
-->
<script type="text/javascript">
    var disqus_config = function () {
        this.page.url = 'https://gitee.com/AmeX/amelin-ting.git/2020/03/01/Go%E5%9F%BA%E7%A1%80------%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86&amp;%E5%8F%98%E9%87%8F&amp;%E5%B8%B8%E9%87%8F/';  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = 'https://gitee.com/AmeX/amelin-ting.git/2020/03/01/Go%E5%9F%BA%E7%A1%80------%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86&amp;%E5%8F%98%E9%87%8F&amp;%E5%B8%B8%E9%87%8F/'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
</script>

<script type="text/javascript">
    $('.btn_click_load').click(function() {  //click to load comments
        (function() { // DON'T EDIT BELOW THIS LINE
            var d = document;
            var s = d.createElement('script');
            s.src = '//http-miccall-tech.disqus.com/embed.js';
            s.setAttribute('data-timestamp', + new Date());
            (d.head || d.body).appendChild(s);
        })();
        $('.btn_click_load').css('display','none');
    });
</script>
</div>
<style>
    #disqus-comment{
        background-color: #eee;
        padding: 2pc;
    }
</style>


        </div>
        <!-- Copyright 版权 start -->
                <div id="copyright">
            <ul>
                <li>&copy;Powered By <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/" style="border-bottom: none;">hexo</a></li>
                <li>Design: <a target="_blank" rel="noopener" href="http://miccall.tech " style="border-bottom: none;">miccall</a></li>
            </ul>
            
                <span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
			
        </div>
    </div>
</body>



 	
</html>
